package com.winhxd.b2c.common.domain.order.enums;

/**
 * @author hjw
 * @create 2019-01-07 16:19
 * 送货方式
 **/
public enum DeliveryTypeEnum {
    /**
     * 立即自提
     */
    SELF_PICK_UP((short) 1, "到店自提"),

    /**
     * 快递邮寄
     */
    EXPRESS_EMAIL((short) 2, "快递邮寄");

    private short typeCode;
    private String typeDesc;

    DeliveryTypeEnum(short typeCode, String typeDesc) {
        this.typeCode = typeCode;
        this.typeDesc = typeDesc;
    }

    public short getTypeCode() {
        return typeCode;
    }

    public String getTypeDesc() {
        return typeDesc;
    }

    public static DeliveryTypeEnum getDeliveryTypeEnumByCode(short code) {
        for (DeliveryTypeEnum deliveryTypeEnum : DeliveryTypeEnum.values()) {
            if (deliveryTypeEnum.getTypeCode() == code) {
                return deliveryTypeEnum;
            }
        }
        return null;
    }

}
